<template>
  <el-form :model="inServForm" ref="inServForm"  size="small">
    <el-form-item  prop="servin">
      <div style="text-align:right;padding:5px 0;"><el-button type="primary" @click="addRow(infiledList)">新增</el-button></div>
      <template>
        <el-table border :data="infiledList" style="width: 100%">
          <el-table-column prop="name" label="属性名称" style="width:6vw;">
            <template slot-scope="scope">
              <el-input size="mini" v-model="scope.row.name"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="type" label="属性值类型">
            <template slot-scope="scope">
              <el-select v-model="scope.row.type" clearable>
                <el-option
                  v-for="item in fildtps"
                  :key="item.value"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="value" label="约束值">
            <template slot-scope="scope">
              <el-input size="mini" v-model="scope.row.value"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="model" label="编辑模式">
            <template slot-scope="scope">
               <el-select v-model="scope.row.source" clearable>
                <el-option
                  v-for="item in modelSelect"
                  :key="item.value"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          
          <el-table-column prop="source" fixed="right" label="编辑模式来源">
             <template slot-scope="scope">
              <el-select v-model="scope.row.source" clearable>
                <el-option
                  v-for="item in fildtps"
                  :key="item.value"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      infiledList: [],
      fildtps: [{ text: "文字", value: "1" }, { text: "数字", value: "2" },{ text: "枚举", value: "3" },{ text: "时间", value: "4" }],//属性值类型
      modelSelect:[{ text: "文本编辑", value: "1" }, { text: "下拉选择", value: "2" },{ text: "查询选择", value: "3" },{ text: "时间选择器", value: "4" }],//编辑模式
      sourceSelect:[{ text: "字典1", value: "1" }, { text: "字典2", value: "2" },{ text: "字典3", value: "3" },{ text: "字典4", value: "4" }],//编辑内容来源
      inServForm: {}
    };
  },
  props: ["tableData"],
  methods: {
    deleteRow(index, rows) {
      //删除改行
      rows.splice(index, 1);
    },
    addRow(tableData, event) {
      tableData.push({ name: "", type: "", value: "",model:"",source:"" });
    }
  }
};
</script>
<style lang="">
</style>